import request from '@/utils/request';

// 用户注册接口
export interface RegisterRequest {
  username: string;
  password: string;
  confirmPassword: string;
  email: string;
}

export interface AuthResponse {
  access_token: string;
  token_type: string;
  user: {
    id: number;
    username: string;
    email: string;
    created_at: string;
  };
}

export const register = (data: RegisterRequest): Promise<AuthResponse> => {
  return request.post('/auth/register', data);
};

// 用户登录接口
export interface LoginRequest {
  username: string;
  password: string;
}

export const login = (data: LoginRequest): Promise<AuthResponse> => {
  return request.post('/auth/login', data);
};